package com.ibeeking.found.msg.rest.controller.v1;

import com.ibeeking.found.msg.rest.service.IWxAutoReplyService;
import com.ibeeking.found.msg.service.common.param.WxAutoReplyParam;
import com.ibeeking.found.msg.service.common.query.WxAutoReplyPageQuery;
import com.ibeeking.found.msg.service.common.vo.WxAutoReplyVO;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

//来源JL
@RestController
@RequestMapping("/b/wxMp/autoReply/v1")
public class WxMpAutoReplyController {

    @Resource
    private IWxAutoReplyService wxAutoReplyServiceImpl;

    /**
    * 分页查询
    * @return
    */
    @Log(logType = OperateLogTypeEnum.QUERY, describe = "消息自动回复分页查询")
    @PostMapping("/pageList")
    public Page<WxAutoReplyVO> getWxAutoReplyPage(@ModelAttribute WxAutoReplyPageQuery pageQuery) {
    	return this.wxAutoReplyServiceImpl.pageList(pageQuery);
    }


    /**
    * 通过id查询消息自动回复
    * @param id id
    * @return R
    */
    @Log(logType = OperateLogTypeEnum.QUERY, describe = "通过id查询消息自动回复")
    @GetMapping("/view/{id}")
    public WxAutoReplyVO getById(@PathVariable("id") Long id){
        return wxAutoReplyServiceImpl.view(id);
    }

    /**
    * 新增消息自动回复
    * @param param 消息自动回复
    * @return R
    */
    @Log(logType = OperateLogTypeEnum.SAVE, describe = "新增消息自动回复")
    @PostMapping("/add")
    public Boolean save(@RequestBody WxAutoReplyParam param){
    	return wxAutoReplyServiceImpl.add(param);
    }

    /**
    * 修改消息自动回复
    * @param param 消息自动回复
    * @return R
    */
    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "修改消息自动回复")
    @PostMapping("/modify")
    public Boolean updateById(@RequestBody WxAutoReplyParam param){
    	return wxAutoReplyServiceImpl.modify(param);
    }

    /**
    * 通过id删除消息自动回复
    * @param id id
    * @return R
    */
    @Log(logType = OperateLogTypeEnum.DEL, describe = "通过id删除消息自动回复")
    @GetMapping("/del/{id}")
    public Boolean removeById(@PathVariable Long id){
    	return wxAutoReplyServiceImpl.del(id);
    }


}
